package edu.ynu.se.xiecheng.achitectureclass.controller;

import edu.ynu.se.xiecheng.achitectureclass.common.controller.LogicController;
import edu.ynu.se.xiecheng.achitectureclass.dao.GreenhouseDao;
import edu.ynu.se.xiecheng.achitectureclass.dto.DeviceInfoDTO;
import edu.ynu.se.xiecheng.achitectureclass.dto.GreenHouseDTO;
import edu.ynu.se.xiecheng.achitectureclass.entity.Greenhouse;
import edu.ynu.se.xiecheng.achitectureclass.service.GreenhouseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "大棚实体的控制器")
@RestController
@RequestMapping("/greenhouse")
public class GreenhouseController extends LogicController<GreenhouseService, GreenhouseDao, Greenhouse, Long> {
    public GreenhouseController(GreenhouseService service) { super(service);}

    @ApiOperation("获取大棚信息")
    @GetMapping("/getGreenhouseInfo")
    public GreenHouseDTO getGreenhouseInfo(@Parameter Long greenhouseId){
        return service.getGreenhouseInfo(greenhouseId);
    }
    @ApiOperation("获取大棚设备信息")
    @GetMapping("/getDevicesInfo")
    public List<DeviceInfoDTO> getDevicesInfo(@Parameter Long greenhouseId){
        return service.getGreenhouseDevicesInfo(greenhouseId);
    }
}
